package ar.edu.utn.frgp.TPFinalBanco.dao.impl;

import java.util.List;

import org.hibernate.Session;

import ar.edu.utn.frgp.TPFinalBanco.dao.DefaultGenericDao;
import ar.edu.utn.frgp.TPFinalBanco.dao.TransferenciaDao;
import ar.edu.utn.frgp.TPFinalBanco.model.Transferencia;

public class TransferenciaDaoImpl extends DefaultGenericDao implements
		TransferenciaDao {

	public void create(Transferencia obj) {
		Session session = hibernateTemplate.getSessionFactory()
				.getCurrentSession();
		session.save(obj);
	}

	public void update(Transferencia obj) {
		Session session = hibernateTemplate.getSessionFactory()
				.getCurrentSession();
		session.saveOrUpdate(obj);
	}

	public void delete(Transferencia obj) {
		Session session = hibernateTemplate.getSessionFactory()
				.getCurrentSession();
		session.delete(obj);
	}

	@SuppressWarnings("unchecked")
	public List<Transferencia> getAll() {
		Session session = hibernateTemplate.getSessionFactory()
				.getCurrentSession();
		
		return (List<Transferencia>) session.createCriteria(Transferencia.class).list();
		
	}

}
